ci: exclude test sources from coverage and document ignore rationale#125
Merged
Conversation
Coverage should measure how well the suite exercises the shipped library, not the test harness. Counting tests/** is circular: assertion helpers and their "test failed" branches are dead code on a green run, so they only depress the patch/project numbers without telling us anything about src/ or include/. Add tests/** to the ignore list (subsuming the previously-listed tests/install_* helpers) and document why each group is excluded, plus the in-source /* LCOV_EXCL_LINE */ convention for unreachable library lines. https://claude.ai/code/session_01XdTFfBgkL344BjVrxARiNc
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #125 +/- ##
==========================================
- Coverage 77.27% 72.73% -4.55%
==========================================
Files 30 12 -18
Lines 3019 1643 -1376
Branches 403 300 -103
==========================================
- Hits 2333 1195 -1138
+ Misses 597 448 -149
+ Partials 89 0 -89 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the repository’s Codecov configuration so coverage metrics reflect library code coverage (src/, include/) rather than coverage of the test harness itself, and documents the rationale inline for future contributors.
Changes:
- Adds
tests/**to Codecov’signore:list, consolidating the previously separatetests/install_*ignore entries. - Adds detailed comments explaining how coverage is produced in this repo and why specific path groups are excluded.
- Adds brief inline rationale to the patch/project coverage thresholds to clarify intent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
tests/**to the Codecovignore:list (consolidating the two previously-listedtests/install_*entries) and documents why each path group is excluded, directly in.codecov.yml.Why
Codecov doesn't instrument anything itself — the
coverageCMake preset compiles everything with--coverage,ctestruns, and the gcov/lcov report is uploaded. Because the test.cfiles are compiled with the same flags andtests/**was not ignored, coverage was being measured on the test harness itself.That's circular and misleading: assertion helpers and their "test failed" branches are dead code on a green run, so they only depress the patch/project percentages without saying anything about how well
src/andinclude/are covered. (This is exactly what produced the spurious "missing lines" on the accessor PR #124 — every uncovered line was in the test file's failure paths, not the library.)Best practice is to gate coverage on library code only. This change makes the metric reflect that.
Notes
/* LCOV_EXCL_LINE */andLCOV_EXCL_START/STOP(e.g.src/dedx_periodic_table.c,src/dedx_mstar.c,src/dedx_validate.c). The added comment points contributors there rather than excluding whole files.examples/**was already ignored;tests/**now matches that same "not the library under test" rationale.This is the policy change discussed on #124, split out so it can be reviewed on its own merits.
Authored via Claude Code.
Generated by Claude Code